<template>
  <div class="">
    <div class="box" v-if="isshow">
      <div class="title">
        <h3>新闻</h3>
        <a href="javaScript:;" @click="col">X</a>
      </div>
      <div class="content">
        <slot></slot>
      </div>
      <div class="foot">
        <button @click="res">清空记录</button>
      </div>
    </div>
    <div v-else>
      <button @click="open">弹出显示框</button>
    </div>
  </div>
</template>
<script >
export default {
  data() {
    return {
      isshow: true,
    };
  },
  props: {},
  components: {},
  created() {},
  mounted() {},
  methods: {
    col() {
      this.isshow = false;
    },
    open() {
      this.isshow = true;
    },
    res() {
      this.$emit("res", []);
    },
  },
};
</script>
<style lang='less' scoped>
* {
  margin: 0;
  padding: 0;
}
.box {
  margin: 100px auto;
  width: 300px;
  border: 1px solid #ccc;
  padding: 20px;
  .title {
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #000;
    margin-bottom: 20px;
    a {
      text-decoration: none;
      color: #000;
    }
  }
  .cotent {
    width: 100%;
    border-bottom: 1px solid #000;
    margin-bottom: 5px;
  }
  .foot {
    padding: 10px;
    width: 100%;
  }
}
</style>